package com.tbit.uqbike.object.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.tbit.uqbike.annos.Excel;
import com.tbit.uqbike.webmanager.util.csv.annotations.Csv;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.math.BigDecimal;
import java.util.Date;

/**
 * 车辆状态统计
 *
 * @author <a href="mailto:yixingang@tbit.com.cn">yee_</a>
 * @version 1.0
 * @see <a href="#">#</a>
 * @since 2024/5/8
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
@TableName(value = "machineoperationsstat")
public class MachineOperationsStat {

    /**
     * 主键
     */
    @TableId(type = IdType.AUTO)
    private Integer id;

    /**
     * 区域id
     */
    private Integer accountId;
    /**
     * 日期
     */
    @Csv(name = "日期",datePattern = "yyyy-MM-dd")
    @Excel(name = "日期", sort = 1)
    private String dataDate;

    /**
     * 时间节点
     * 1-表示0~1点 2-表示1~2点 0-表示当天0~24点
     */
    @Csv(name = "时段")
    @Excel(name = "时段", sort = 2)
    private Integer timeSlot;
    /**
     * 区域名称
     */
    @Csv(name = "运营区域名称")
    @Excel(name = "运营区域名称", sort = 3)
    private String accountName;

    /**
     * 车辆总数
     */
    @Csv(name = "车辆总数")
    @Excel(name = "车辆总数", sort = 4)
    private Integer machineCount;

    /**
     * 可运营车辆数
     */
    @Csv(name = "车辆可运营数")
    @Excel(name = "车辆可运营数", sort = 5)
    private Integer availableRent;

    /**
     * 不可运营车辆数
     */
    @Csv(name = "车辆不可运营数")
    @Excel(name = "车辆不可运营数", sort = 6)
    private Integer unAvailableRent;

    /**
     * 骑行订单数
     */
    @Csv(name = "骑行订单数")
    @Excel(name = "骑行订单数", sort = 7)
    private Integer rideOrderCount;

    /**
     * 产生订单车辆数
     */
    @Csv(name = "产生订单车辆数")
    @Excel(name = "产生订单车辆数", sort = 8)
    private Integer orderCarCount;

    /**
     * 骑行订单收益
     */
    @Csv(name = "收入金额(元)")
    @Excel(name = "收入金额(元)", sort = 9)
    private BigDecimal rideMoneySum;

    /**
     * 换电次数
     */
    @Csv(name = "换电次数")
    @Excel(name = "换电次数", sort = 10)
    private Integer powerChange;

    /**
     * 挪车次数
     */
    @Csv(name = "挪车次数")
    @Excel(name = "挪车次数", sort = 11)
    private Integer move;

    /**
     * 调度次数
     */
    @Csv(name = "调度次数")
    @Excel(name = "调度次数", sort = 12)
    private Integer dispatch;
    /**
     * 站外还车
     */
    @Csv(name = "站外还车")
    @Excel(name = "站外还车", sort = 13)
    private Integer outSideReturn;

    /**
     * 超区还车
     */
    @Csv(name = "超区还车")
    @Excel(name = "超区还车", sort = 14)
    private Integer outAreaReturn;

    /**
     * 低电车辆
     */
    @Csv(name = "低电车辆")
    @Excel(name = "低电车辆", sort = 15)
    private Integer lowBattery;
    /**
     * 电池异常
     */
    @Csv(name = "电池异常车辆")
    @Excel(name = "电池异常车辆", sort = 16)
    private Integer batteryAbnormal;
    /**
     * 无信号
     */
    @Csv(name = "无信号车辆")
    @Excel(name = "无信号车辆", sort = 17)
    private Integer noSignal;
    /**
     * 故障车辆(运维上报)
     */
    @Csv(name = "故障车辆")
    @Excel(name = "故障车辆", sort = 18)
    private Integer fault;
    /**
     * 站外车辆
     */
    @Csv(name = "站外车辆")
    @Excel(name = "站外车辆", sort = 19)
    private Integer outSide;
    /**
     * 超区车辆
     */
    @Csv(name = "超区车辆")
    @Excel(name = "超区车辆", sort = 20)
    private Integer outArea;

    /**
     * 闲置车辆数(短时)
     */
    @Csv(name = "闲置车辆数（短时）")
    @Excel(name = "闲置车辆数（短时）", sort = 21)
    private Integer idleShort;

    /**
     * 闲置车辆数(中时)
     */
    @Csv(name = "闲置车辆数（中时）")
    @Excel(name = "闲置车辆数（中时）", sort = 22)
    private Integer idleMiddle;

    /**
     * 闲置车辆数(高时)
     */
    @Csv(name = "闲置车辆数（长时）")
    @Excel(name = "闲置车辆数（长时）", sort = 23)
    private Integer idleLong;

    /**
     * 添加时间
     */
    private Date addTime;
    /**
     * 修改时间
     */
    private Date updateTime;


    public MachineOperationsStat(Integer accountId, String accountName) {
        this.accountId = accountId;
        this.accountName = accountName;
    }

    public void nullDefault() {
        this.machineCount = 0;
        this.availableRent = 0;
        this.unAvailableRent = 0;
        this.rideOrderCount = 0;
        this.orderCarCount = 0;
        this.rideMoneySum = BigDecimal.ZERO;
        this.powerChange = 0;
        this.dispatch = 0;
        this.move = 0;
        this.outSideReturn = 0;
        this.outAreaReturn = 0;
        this.lowBattery = 0;
        this.outSide = 0;
        this.outArea = 0;
        this.fault = 0;
        this.noSignal = 0;
        this.batteryAbnormal = 0;
        this.idleShort = 0;
        this.idleMiddle = 0;
        this.idleLong = 0;
    }

}
